/**
 * 
 */
package No401_500.No411_420.ThirdMaximumNumber_414;

import java.util.Stack;

/**
 * @author 李敬
 *
 */
public class Solution {
	
	public int thirdMax(int[] nums) {
		int num = 0;
		int[] backUp = new int[3];
		int backNum = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < nums.length; i++) {
			while (!stack.empty()) {
				int temp = stack.pop();
				if (nums[i]>temp) {
					backUp[backNum++] = temp;
				}else {
					stack.push(temp);
					break;
				}
			}
			
		}
//		max[0] = nums[0];
		return backNum ;
    }

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
